package com.example.newinfinity.View.DrawShape

import android.graphics.Canvas
import android.graphics.Paint

//画自由曲线
class FreeCurveShape() : Shape() {

    override fun setStartPoint(x: Float, y: Float) {
        super.setStartPoint(x, y)
        mPath.moveTo(startX, startY)
    }

    override fun setEndPoint(x: Float, y: Float) {
        super.setEndPoint(x, y)
        mPath.lineTo(endX, endY)
    }

    override fun draw(canvas: Canvas) {
        //绘制自由曲线时需修改画笔的style
        mPaint.style = Paint.Style.STROKE
        canvas.drawPath(mPath, mPaint)

        //继承父类 拖拉点拽状态为selected时显示边框及四个拖拉圆点
        super.draw(canvas)
    }

    override fun fillColor() {
        super.fillColor()
    }

    override fun containsPointInPath(x: Float, y: Float): Boolean {
        return super.containsPointInPath(x, y)
    }
}